<?php
    require "conn.php";
    //获取前端来的值
    $name = $_GET["n"];
    
    
    $sql = "SELECT * FROM liuyan WHERE name='$name' order by 1 desc";
    $result = mysqli_query($conn, $sql);
    if (!$result) {
        echo "没人留言";
    }else{
		if (mysqli_num_rows($result) == 0) {
		    echo "<div class='msg'>似乎没有一个人给你留言哦</div>";
		}else{
			while($res = mysqli_fetch_assoc($result)) {   
				if($res["logo"] == "auto" || $res["logo"] == ""){
					$res["logo"] = "auto2.png";
				}else{
					$res["logo"] = "http://q1.qlogo.cn/g?b=qq&nk=".$res["logo"]."&s=100";
				}
				echo '<div class="msg">';
				echo "<img src=".$res["logo"]."></img>";
				echo "<span class='m'>匿名小可爱</span>";
				echo "<p class='txt'>".$res["txt"]."</p>";
				echo "<p class='date'>".$res["time"]."</p></div>";
			}
		}
    }
?>